package com.office.util;

import java.util.HashMap;
import java.util.Map;

/**
 * 代码生成类,会生成dao,service,serviceImpl相关的代码,原来的代码会被覆盖
 */
public class Generator {

	// 根据命名规范，只修改此常量值即可
	private static String DATABASE = "gameoffice";
	// 表的前缀
	private static String TABLE_PREFIX = "";
	private static String PACKAGE_NAME = "com.office";
	private static String JDBC_DRIVER = PropertiesFileUtil.getInstance("jdbc").get("jdbc.driverClass");
	private static String JDBC_URL = PropertiesFileUtil.getInstance("jdbc").get("jdbc.jdbcUrl");
	private static String JDBC_USERNAME = PropertiesFileUtil.getInstance("jdbc").get("jdbc.user");
	// AES加密的密码
	private static String JDBC_PASSWORD = AESUtil.aesEncode(PropertiesFileUtil.getInstance("jdbc").get("jdbc.password"));
	
	// 需要insert后返回主键的表配置，key:表名,value:主键名
	private static Map<String, String> LAST_INSERT_ID_TABLES = new HashMap<String, String>();
	static {
		
	}

	/**
	 * 自动代码生成
	 */
	public static void main(String[] args) throws Exception {
		MybatisGeneratorUtil.generator(JDBC_DRIVER, JDBC_URL, JDBC_USERNAME, JDBC_PASSWORD, DATABASE, TABLE_PREFIX, PACKAGE_NAME, LAST_INSERT_ID_TABLES);
	}

}
